﻿using System;
using System.Windows.Media;
using FluentAssertions;
using Hopscotch.Presentation.Common.Converters;
using Moq;
using NUnit.Framework;

namespace Hopscotch.Presentation.Common.Test.Converters
{
    [TestFixture]
    public class FieldEditModeToBrushConverterTest
    {

        private Mock<IToolViewModel> mockTestEntityViewModel;

        private FieldEditModeToBrushConverter fieldEditModeToBrushConverter;

        [SetUp]
        public void SetUp()
        {
            mockTestEntityViewModel = new Mock<IToolViewModel>();
            fieldEditModeToBrushConverter = new FieldEditModeToBrushConverter();
        }

        [TestCase(ToolEditMode.None)]
        [TestCase(ToolEditMode.New)]
        [TestCase(ToolEditMode.Update)]
        [TestCase(ToolEditMode.Delete)]
        public void TestConvertEditMode(ToolEditMode toolEditMode)
        {
            mockTestEntityViewModel.Setup(x => x.GetFieldEditMode(It.IsAny<string>())).Returns(toolEditMode);

            object[] values = new object[]{ mockTestEntityViewModel, "Field", 0 };

            var brush = fieldEditModeToBrushConverter.Convert(values, typeof(Brush), null, null);
            brush.Should().BeAssignableTo<Brush>();
        }
    }
}
